<template>
  <!-- 底部部分 => list有数据的时候，才展示  list.length > 0 -->
  <footer  class="footer" v-if="list.length>0">
    <span class="todo-count"><strong>{{sy}}</strong>剩余</span>
    <ul class="filters">
      <li>
        <a :class="{selected:zt==='all'}"  href="#/" @click="$emit('gzt','all')">全部</a>
      </li>
      <li>
        <a :class="{selected:zt==='jx'}" href="#/active" @click="$emit('gzt','jx')">进行中</a>
      </li>
      <li>
        <a :class="{selected:zt==='wc'}" href="#/completed" @click="$emit('gzt','wc')">已完成</a>
      </li>
    </ul>
    <!-- 有已完成的任务，才需要显示这个按钮 -->
    <button  class="clear-completed" @click="$emit('qc')">清除已完成</button>
  </footer>
</template>

<script>
export default {
  computed:{
    sy(){
      return this.list.filter(item=>item.done===false).length
    }
  },
  props:{
    zt:{
      type:String
    },
    list:{
      type:Array,
      required:true
    }
  },
}
</script>

<style></style>
